home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
batmen.zip
/
BATMEN.DOC
< prev
next >
Wrap
Text File
|
1989-06-28
|
19KB
|
416 lines
BatMenu
V1.00 28-Jun-1989
Copyright (C) 1989 by Simple Solutions, Inc.
All Rights Reserved
A Shareware Product
from
Simple Solutions, Inc.
P.O. Box 640189
Kenner, LA 70064
(504) 464-5748
Written by
Mark W. Geisinger
CIS 76440,76
GEnie M.GEISINGER
BIX m.geisinger
BatMenu is a menu utility intended to be used within DOS batch files. Well,
that's how it started out anyway. Explore some of the possibilities here and
you'll see its a bit more than just a "menu utility".
BatMenu provides you with a simple interface into a powerful menu control
system which allows you considerable flexibility in displaying windowed text
and prompting your batch file user for a response. The user of your batch
files is given a sophisticated interface including intelligent circular
scrolling of the highlight bar and bi-directional scrolling of text.
BatMenu is a copyrighted work and has been released for distribution as
SHAREWARE. Please read the file LICENSE.DOC before using BatMenu.
Overview
--------
BatMenu uses a data file for menu text storage and allows you to store
numerous menus in a single file through the use of "keyword" system. Keywords
are identified in the data file by a "keyword character", or marker,
preceding the keyword as the first character on a line. The data file size
limits are generous. You are allowed up to 500 lines of 76 characters each.
Menu selections are returned to your batch file (or other calling program)
via the DOS errorlevel. There are ten possible values for errorlevel, 0
through 9. BatMenu reserves 0 (zero) as an error indicator, leaving values 1
through 9 available for your use.
Menu Limits
-----------
A single menu may, in theory, contain up to 500 lines. As a practical matter
however, each menu is limited to 9 choices which return a unique value to
your batch file. The return values correspond directly with the order of the
menu items. The first menu item sets errorlevel to 1, the ninth menu item
will set errorlevel to 9.
If an error occurs, BatMenu returns with errorlevel set to zero. You'll
find that the error checking in BatMenu is very good for the most likely to
occur errors. Additionally, an error message is generated if BatMenu aborts
for any reason.
Menus with more than nine choices will function properly, except that the
highest return value is 9, so any menu selection by the user past the ninth
item will return with errorlevel set to 9. This is a limit imposed by using
errorlevel as a method of communication with the batch file, not one imposed
by BatMenu's menu system.
Windows with BatMenu
--------------------
While BatMenu was not developed as a windowing system, menus and windows here
are closely related and much of the work necessary to display windowed text
has been done in the implementation of the menu system.
You can take advantage of this by using BatMenu to display formatted text in
a window. Bi-directional scrolling is allowed. This should come in handy if
you want to place an attractive message on the screen or allow a user of your
batch file to scroll through text or instructions of some kind. The demo
batch file included here has several examples of just such a usage of
BatMenu.
By the way, if you like this aspect of BatMenu let me know. As I said, much
of the work for a windowing system is place for the menus. Enhancing the
windowing capabilities is certainly possible given the demand for it.
Menu/Window Definition
----------------------
Menu definition with BatMenu is simple. You tell it where to place the menu
and what size it should be. This is done with four command line parameters
that represent the first-row, first-column, number-rows, and the
number-columns for the menu. The command line parameters are named as 'fr',
'fc', 'nr', and 'nc' in the abstract below.
Here's the fun part. This is how you specify to BatMenu where to place the
menu on the screen and what size it should be. While this is very simple, it
may not be as straightforward as it first appears. The reason for my
qualification of its simplicity is that you must realize that you are
specifying the menu window borders, not just the size of the text area.
BatMenu will attempt to put a leading and trailing space on each line in the
window to separate it from the border. This means the total width of a menu
will be the length of your longest line (limited to 76 char. in the
BATMEN.TXT file) plus 2 characters for the left and right borders, plus two
characters for spacing. Simply stated, line length + 4 = number-columns.
For instance, if you want a menu that borders your text tightly
on all sides...
Assuming your menu's first-column is 10
and your longest menu line is 20 characters
then, specify the number-columns with the calculation -
first-column + number-columns + 4
or
10 + 20 + 4 = 34
Thus, 34 would be specified on the command line for the
'nc' parameter.
Formatted Text
--------------
This is one place where BatMenu doesn't do all the work for you. That's no
problem though. You can format the text in a window or menu any way you like
in the data file BATMEN.TXT. Formatting should be done with spaces, not
embedded tab characters. Just decide how you want your text to appear in the
window (with consideration of window size, of course), and use your favorite
text editor to edit the BATMEN.TXT file. Take a look at the BATMEN.TXT
included with BatMenu and you'll see several examples used in the BatDemo
file (I really should go see the movie...).
BatMenu will allow the user to scroll forwards or backwards through text that
is larger than the window. This is bi-directional vertical scrolling. No
provision is made for horizontal scrolling. Additionally, long lines will be
truncated when displayed, so check your line length against the window size
you are using to make sure that nothing gets zapped from the end of a line.
This applies to both windows and menus.
The BATMEN.TXT Data file
------------------------
BatMenu uses a simple ASCII text file for its menu and window data. The file
must be named BATMEN.TXT. An example BATMEN.TXT file is included with
BatMenu for use in the demo. BatMenu uses a very simple "keyword" system to
allow you to store as many menus or windows as you like in the BATMEN.TXT
file.
==== Storing Menu/Window text in the Data file
The data stored for a menu or window is simply the ASCII text that will be
displayed in the menu or window. No translation of characters is done, so
you shouldn't include any control characters or non-printing characters.
Spacing or formatting should be done only with true spaces, not embedded tab
characters. Other than that, whatever text you put into the file will be
displayed in the format (spaced) you wrote it.
==== The "keyword" system
Different menus or windows are distinguished in the data file using the
"keyword" method mentioned previously. This is a very simple method that
allows you to store numerous groups of text in one file. You may think of
the data file being divided into sections by the keywords and you may access
or use any individual section by telling BatMenu which one to use by giving
it the proper keyword.
A keyword in the data file must start with an asterisk, '*', and the asterisk
must be the first character on the line containing the keyword. The
remainder of keyword may be any combination of characters or words that may
otherwise be used